﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <el-form ref="formRefPassStationRecord" :model="statePassStationRecord.vmModel" label-width="100px">
    <div style="margin-bottom:10px;">{{$t('message.autotrans.SysBatchEditConfirm')}}</div>
    <el-row>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_LineCode_FormItem" prop="LinkedVM.LineCode" :label="$t('message.autotrans._Model_PassStationRecord_lineCode')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_PassStationRecord_lineCode')}), trigger: 'blur' }]" >
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.LineCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_MaterialCode_FormItem" prop="LinkedVM.MaterialCode" :label="$t('message.autotrans._Model_PassStationRecord_materialCode')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.MaterialCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_MaterialName_FormItem" prop="LinkedVM.MaterialName" :label="$t('message.autotrans._Model_PassStationRecord_materialName')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.MaterialName" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_MaterialVersion_FormItem" prop="LinkedVM.MaterialVersion" :label="$t('message.autotrans._Model_PassStationRecord_materialVersion')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.MaterialVersion" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_OperationCode_FormItem" prop="LinkedVM.OperationCode" :label="$t('message.autotrans._Model_PassStationRecord_operationCode')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.OperationCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_OrderCode_FormItem" prop="LinkedVM.OrderCode" :label="$t('message.autotrans._Model_PassStationRecord_orderCode')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.OrderCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_PassBeginTime_FormItem" prop="LinkedVM.PassBeginTime" :label="$t('message.autotrans._Model_PassStationRecord_passBeginTime')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.PassBeginTime" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_PassEndTime_FormItem" prop="LinkedVM.PassEndTime" :label="$t('message.autotrans._Model_PassStationRecord_passEndTime')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.PassEndTime" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_PassStatus_FormItem" prop="LinkedVM.PassStatus" :label="$t('message.autotrans._Model_PassStationRecord_passStatus')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.PassStatus" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_ScheduleCode_FormItem" prop="LinkedVM.ScheduleCode" :label="$t('message.autotrans._Model_PassStationRecord_scheduleCode')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.ScheduleCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_SnNumber_FormItem" prop="LinkedVM.SnNumber" :label="$t('message.autotrans._Model_PassStationRecord_snNumber')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_PassStationRecord_snNumber')}), trigger: 'blur' }]" >
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.SnNumber" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_StationCode_FormItem" prop="LinkedVM.StationCode" :label="$t('message.autotrans._Model_PassStationRecord_stationCode')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.StationCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_ShipCode_FormItem" prop="LinkedVM.ShipCode" :label="$t('message.autotrans._Model_PassStationRecord_shipCode')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.ShipCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_MachineCode_FormItem" prop="LinkedVM.MachineCode" :label="$t('message.autotrans._Model_PassStationRecord_machineCode')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.MachineCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Uploadflag_FormItem" prop="LinkedVM.Uploadflag" :label="$t('message.autotrans._Model_PassStationRecord_uploadflag')">
          <el-select v-model="statePassStationRecord.vmModel.LinkedVM.Uploadflag" clearable>
             <el-option :key="1" :value=true :label="$t('message._system.common.vm.tips_bool_true')"></el-option>
             <el-option :key="0" :value=false :label="$t('message._system.common.vm.tips_bool_false')"></el-option>
          </el-select>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_UserId_FormItem" prop="LinkedVM.UserId" :label="$t('message.autotrans._Model_PassStationRecord_userId')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.UserId" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_UserName_FormItem" prop="LinkedVM.UserName" :label="$t('message.autotrans._Model_PassStationRecord_userName')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.UserName" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_IsProduct_FormItem" prop="LinkedVM.IsProduct" :label="$t('message.autotrans._Model_PassStationRecord_isProduct')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.IsProduct" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_ReqType_FormItem" prop="LinkedVM.ReqType" :label="$t('message.autotrans._Model_PassStationRecord_reqType')">
          <el-input v-model="statePassStationRecord.vmModel.LinkedVM.ReqType" clearable></el-input>
      </el-form-item>

      </el-col>
    </el-row>

    <div style="text-align:right;">
      <WtmButton @click="onSubmitPassStationRecord"  type="primary" :button-text="$t('message.autotrans.SysSubmit')" style="margin-top:15px;"/>

      <WtmButton @click="onClosePassStationRecord"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

    </div>

  </el-form>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageRecordPassStationRecordBatchEdit;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { passstationrecordApi } from '/@/api/record/passstationrecord';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefPassStationRecord = ref();
const statePassStationRecord = reactive({
    vmModel: {
	  LinkedVM:{
        LineCode: '',
        MaterialCode: '',
        MaterialName: '',
        MaterialVersion: '',
        OperationCode: '',
        OrderCode: '',
        PassBeginTime: '',
        PassEndTime: '',
        PassStatus: '',
        ScheduleCode: '',
        SnNumber: '',
        StationCode: '',
        ShipCode: '',
        MachineCode: '',
        Uploadflag: undefined,
        UserId: '',
        UserName: '',
        IsProduct: '',
        ReqType: '',
      },
      Ids:[],
      
	},
    
});

// 取消
const onClosePassStationRecord = () => {
    closeDialog();
};

// 提交
const onSubmitPassStationRecord = () => {
	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});

    formRefPassStationRecord.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            passstationrecordApi().batchedit(statePassStationRecord.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error:any) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
	})
};


// 页面加载时
onMounted(() => {
    
    if (ci.attrs["wtmdata"]) {
		statePassStationRecord.vmModel.Ids = ci.attrs["wtmdata"];
	}
	else if (useRouter().currentRoute.value.query.id) {
		statePassStationRecord.vmModel.Ids = useRouter().currentRoute.value.query.id as any;
	}

});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

